<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../layui/css/layui.css" media="all">
<title>申请成为商家</title>
<style>
	.layui-input{
		border:none;
	}
</style>
</head>

<body>

	<fieldset class="layui-elem-field layui-field-title"
		style="margin-top: 20px;">
		<legend>申请成为商家</legend>
	</fieldset>

	<form id="myform" class="layui-form" lay-filter="myform">
		<input type="hidden" id="usersId" name="usersId">
		<input type="hidden" id="isva" name="isva" value="1">
		<div class="layui-form-item">
			<label class="layui-form-label">商家名称</label>
			<div class="layui-input-block">
				<input type="text" name="businessName" id="businessName" lay-verify="required" style="width:300px;"
					placeholder="请输入商家名称" autocomplete="off" class="layui-input"
					maxlength="10">
			</div>
		</div>
		
		<!-- 提交重置 -->
		<div class="layui-form-item">
			<div class="layui-input-block">
				<a class="layui-btn" id="update">提交</a>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>

	<script src="../layui/layui.js"></script>
	<script type="text/javascript"
		src="../res/js/jquery-1.10.2.js"></script>
	<script src="../res/js/base.two.js"></script>
	<script type="text/javascript">
	layui.use(['form', 'layer','laydate','upload'], function(){
		  var form = layui.form
		  ,layer = layui.layer
		  ,laydate = layui.laydate
		  ,upload = layui.upload
		  ,$ = layui.$;
		  	
		$("#usersId").val(user.usersId);
		
		$("#update").click(function(){
			if($("#businessName").val() == null || $("#businessName").val() == ''){
				layer.msg("请填写商家名称",{icon:5,time:1000,anim:6});
				return;
			}
			
			var data = $("#myform").serialize();
			var url = "../user/saveOrUpdate.action";
			$.ajax({
				url:url,
				data:data,
				success:function(msg){
					if(msg.state == "1"){
						layer.msg("提交成功!,等待管理员审核",{icon:1,time:1000},function(){
							var index = parent.layer.getFrameIndex(window.name);  
	    				    parent.layer.close(index);
						});
					}else{
						layer.msg("提交失败!,请重新提交",{icon:2,time:1000},function(){
							var index = parent.layer.getFrameIndex(window.name);  
	    				    parent.layer.close(index);
						});
					}
				}
			});
		});
		  
	});
	</script>
</body>
</html>